package cn.kgc.shiroday03.controller;

import cn.kgc.shiroday03.commons.CodeMsg;
import cn.kgc.shiroday03.commons.ResponseResult;
import cn.kgc.shiroday03.entity.LogInfo;
import cn.kgc.shiroday03.service.LogInfoService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: 课工场
 * @Version: v1.0  2023/6/13
 * @Description:日志模块
 */
@RestController
@RequestMapping("log")
@Api(tags = "日志模块")
public class LogController {

    @Autowired
    private LogInfoService logInfoService;
    @GetMapping("all")
    @ApiOperation("日志列表")
    public ResponseResult getList(Integer page,Integer limit) {

        Page<LogInfo> logInfoPage = new Page<>(page, limit);

        logInfoService.page(logInfoPage);
        long total = logInfoPage.getTotal();
        List<LogInfo> records = logInfoPage.getRecords();
        return  new ResponseResult(CodeMsg.SUCCESS,total,records);
    }

}
